import os, sys, numpy, shutil
from stat import *

training_set_dir = '[path]/training_set'
reduced_training_set_dir = '[path]/reduced_training_set'
	
def analyze_files():
	size_list = []	
	for file in os.listdir(training_set_dir):
		size_list.append(os.stat(training_set_dir + '/' + file)[ST_SIZE])

	mean = numpy.mean(size_list)
	std_dev = numpy.std(size_list)
	hist = numpy.histogram(size_list)

	print "mean is %f" % mean
	print "std is %f" % std_dev
	print hist
	
def test_files(min_file_size):
	num_files = 0
	file_list = []
	for file in os.listdir(training_set_dir):
		if os.stat(training_set_dir + '/' + file)[ST_SIZE] > min_file_size:
			num_files+=1
			file_list.append(file)
	print num_files
	return file_list

def copy_files(file_list):
	for file in file_list:
		shutil.copyfile(training_set_dir + '/' + file, reduced_training_set_dir + '/' + file)


		
min_file_size = 4.7943e5
file_list = test_files(min_file_size)
copy_files(file_list)
#compile_tag_file()
		